/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Modele;

import java.util.Collection;

/**
 *
 * @author sio
 */
public class Pays {
    private Collection<Dep> lesDeps;
    private Collection <Spe> lesSpes;
    
    public Pays(){
        lesDeps = DAO.getLesDeps();
        lesSpes = DAO.getLesSpes();
        Collection <Med> lesMeds = DAO.getLesMeds();
        for (Med unMed : lesMeds){
            for(Dep unDep : lesDeps){
                if (unDep.getNum().equals(unMed.getDep())){
                    unDep.addMed(unMed);
                }
            }
            for (Spe uneSpe : lesSpes){
                if (uneSpe.getNom().equals(unMed.getSpe())){
                    uneSpe.addMed(unMed);
                }
            }
            
        }
    }
    public Collection<Dep> getLesDeps(){
        return this.lesDeps;
    }
    public Collection<Spe> getLesSpes(){
        return this.lesSpes;
    }
    public Dep getLeDep(String numDep){
        for(Dep d : lesDeps){
            if(d.getNum().equals(numDep)){
                return d;
            }
        }
        return null;
    }
    public Spe getLaSpe(String nomSpe){
        for(Spe s : lesSpes){
            if(s.getNom().equals(nomSpe)){
                return s;
            }
        }
        return null;
    }
}
